NoSQL operator: tablecat

Concatenates multiple NoSQL tables and prints them to STDOUT in
the form of one larger table. The input tables must all have the
same number of columns.

Usage: tablecat [options] table [table ...]

Options:
    --help (-h)
      Display this help text.

    --no-header (-N)
      Suppress the table header from output.

    --first-table (-f) 'table'
      Read the table header from 'table'. Mostly useful when
      'tablecat' is run from xargs(1). See below.

    --path-elements (-p) 'list'
      Append to the resulting table as many columns as there are
      comma-separated values in 'list', where the value of each
      column is taken from the corresponding element in each input
      filepath. See below for more explanations.

Notes:

The output table header will be taken from 'table' and the latter,
if present, is expected to be the first non-option argument. This
is useful in constructs like:

find path/ -name '*.table' | xargs [-n num] tablecat --first-table table1

where 'num' is the max. number of 'table' parameters passed to a single
instance of 'tablecat' by xargs(1). Make sure that 'table1' is specified
in the way it is printed by find(1), i.e: 'path/.../file.table'

Warning: if the files being listed with find(1) are known to contain
spaces or other special characters in their names, then 'find -print0'
should be used instead. See find(1) for more information.

The tables listed on the command line must all have the same structure,
with the same number of columns.

A common situation with the filesystem-based approach taken by NoSQL
is to have a larger table which is split into smaller subtables across
diffrente directories, where each directory represents an additional
table attribute. For instance, say we have two tables with the same
structure, each of which is stored in a separate directory tree, like
this:

/path/to/Europe/Italy/table
/path/to/America/Wisconsin/table

Unless the 'Italy' and 'Wisconsin' values are repeated inside each table
(a redundancy that should be avoided), it will not be easy to associate
each table record with either countries by using simple queries. Here is
where the '-p' option of this program comes handy. The command

tablecat -p 2 /path/to/Europe/Italy/table /path/to/America/Wisconsin/table

will append a new column to the output table, containing the value 'Italy'
for every record in the first table and the value 'Wisconsin' for every
record in the second table.

Likewise, by saying

tablecat -p 3,2 /path/to/Europe/Italy/table /path/to/America/Wisconsin/table

the resulting table will be appended two new columns, containing
respectively the name of the continent and the name of the country
associated with each record in the two tables being concatenated
together.

Note that path components are numbered fron right to left, whereby
the individual components of /path/to/Europe/Italy/table are:

1 = 'table'
2 = 'Italy'
3 = 'Europe'
... and so on.

Nonexistent path components specified on the command-line, either on
their own (i.e. '-p 8') or in a list (i.e.: '-p 1,3,8') will produce
empty columns in output. If any existing component is listed more than
once its value will be appended as many times, although it does not make
much sense.

The columns appended by this program will be named automatically in a
sequential fashion, and their names will have no relationship with the
numbers specified in the '-p' option.
Back